﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;

namespace MyCpuMonitor.Classes.WMI
{
    public class ComputerSystem
    {
        #region global vars

        private readonly ManagementObjectSearcher _mos;
        private readonly ManagementObjectCollection _moc;

        #endregion

        #region Ctor

        public ComputerSystem()
        {
            _mos = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
            _moc = _mos.Get();
        }

        #endregion

        public string AdminPasswordStatus()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["AdminPasswordStatus"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string AutomaticManagedPagefile()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["AutomaticManagedPagefile"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string AutomaticResetBootOption()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["AutomaticResetBootOption"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string AutomaticResetCapability()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["AutomaticResetCapability"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string BootOptionOnLimit()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["BootOptionOnLimit"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string BootOptionOnWatchDog()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["BootOptionOnWatchDog"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string BootRomSupported()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["BootROMSupported"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string BootupState()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["BootupState"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string Caption()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["Caption"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string ChassisBootupState()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["ChassisBootupState"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string CreationClassName()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["CreationClassName"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string CurrentTimeZone()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["CurrentTimeZone"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string DaylightInEffect()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["DaylightInEffect"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string Description()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["Description"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string DnsHostName()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["DNSHostName"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string Domain()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["Domain"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string DomainRole()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["DomainRole"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string EnableDaylightSavingsTime()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["EnableDaylightSavingsTime"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string FrontPanelResetStatus()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["FrontPanelResetStatus"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string InfraredSupported()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["InfraredSupported"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string InitialLoadInfo()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["InitialLoadInfo"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string InstallDate()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["InstallDate"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string KeyboardPasswordStatus()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["KeyboardPasswordStatus"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string LastLoadInfo()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["LastLoadInfo"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string Manufacturer()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["Manufacturer"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string Model()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["Model"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string Name()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["Name"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string NameFormat()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["NameFormat"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string NetworkServerModeEnabled()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["NetworkServerModeEnabled"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string NumberOfLogicalProcessors()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["NumberOfLogicalProcessors"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string NumberOfProcessors()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["NumberOfProcessors"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string OemLogoBitmap()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["OEMLogoBitmap"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string OemStringArray()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["OEMStringArray"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PartOfDomain()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PartOfDomain"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PauseAfterReset()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PauseAfterReset"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PCSystemType()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PCSystemType"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PowerManagementCapabilities()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PowerManagementCapabilities"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PowerManagementSupported()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PowerManagementSupported"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PowerOnPasswordStatus()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PowerOnPasswordStatus"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PowerState()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PowerState"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PowerSupplyState()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PowerSupplyState"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PrimaryOwnerContact()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PrimaryOwnerContact"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string PrimaryOwnerName()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["PrimaryOwnerName"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string ResetCapability()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["ResetCapability"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string ResetCount()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["ResetCount"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string ResetLimit()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["ResetLimit"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string Roles()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["Roles"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string Status()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["Status"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string SupportContactDescription()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["SupportContactDescription"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string SystemStartupDelay()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["SystemStartupDelay"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string SystemStartupOptions()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["SystemStartupOptions"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string SystemStartupSetting()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["SystemStartupSetting"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string SystemType()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["SystemType"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string ThermalState()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["ThermalState"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string TotalPhysicalMemory()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["TotalPhysicalMemory"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string UserName()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["UserName"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string WakeUpType()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["WakeUpType"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }

        public string Workgroup()
        {
            var s = "";
            try
            {
                foreach (var o in _moc)
                    s = o["Workgroup"].ToString().Trim();
            }
            catch
            {
                s = "Unable to Determine";
            }

            return s;
        }
    }
}